package com.fanfq.loancalc;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class MainActivity extends Activity {
	
	private ArrayAdapter<String> mArrayAdapter;
	private ListView mListView;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        mArrayAdapter = new ArrayAdapter<String>(this, R.layout.text_stlye, getResources().getStringArray(R.array.frist));
        mListView = (ListView) findViewById(R.id.frist);
        mListView.setAdapter(mArrayAdapter);
        mListView.setOnItemClickListener(mClickListener);
    }
    
    private OnItemClickListener mClickListener = new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			Intent intent = new Intent();  
			switch (arg2) {
			case 0:
			    intent.setClass(MainActivity.this, Calc0Activity.class);  
				startActivity(intent);
				break;
			case 1:
				break;
			case 2:
				break;
			case 3:
				break;
			case 4:
				intent.setClass(MainActivity.this, Calc5Activity.class);  
				startActivity(intent);
				break;
			case 5:
				break;
			default:
				break;
			}
		}
    	
    };
}